using DslDiagrams = global::Microsoft.VisualStudio.Modeling.Diagrams;
using DslModeling = global::Microsoft.VisualStudio.Modeling;

namespace Microsoft.Modeling.StoryboardDesigner
{
    /// <summary>
    /// Serializer MultiLineCompartmentSerializer for DomainClass MultiLineCompartment.
    /// </summary>
    public partial class MultiLineCompartmentSerializer : DslDiagrams::CompartmentSerializer
    {
        #region Constructor
        /// <summary>
        /// MultiLineCompartmentSerializer Constructor
        /// </summary>
        public MultiLineCompartmentSerializer()
            : base()
        {
        }
        #endregion

        #region Public Properties
        /// <summary>
        /// This is the XML tag name used to serialize an instance of MultiLineCompartment.
        /// </summary>
        public override string XmlTagName
        {
            //[global::System.Diagnostics.DebuggerStepThrough]
            get { return @"multiLineCompartment"; }
        }

        /// <summary>
        /// This is the XML tag name used to serialize a monikerized instance of MultiLineCompartment.
        /// </summary>
        public override string MonikerTagName
        {
            //[global::System.Diagnostics.DebuggerStepThrough]
            get { return @"multiLineCompartmentMoniker"; }
        }

        /// <summary>
        /// This is the name of the XML attribute that stores the moniker of MultiLineCompartment in a serialized monikerized instance.
        /// </summary>
        public override string MonikerAttributeName
        {
            //[global::System.Diagnostics.DebuggerStepThrough]
            get { return @"Id"; }
        }
        #endregion

        #region Read Methods
        /// <summary>
        /// Public Read() method that deserializes one MultiLineCompartment instance from XML.
        /// </summary>
        /// <remarks>
        /// When this method is called, caller guarantees that the passed-in XML reader is positioned at the open XML tag
        /// of the MultiLineCompartment element that is about to be deserialized. 
        /// The method needs to ensure that when it returns, the reader is positioned at the open XML tag of the next sibling element,
        /// or the close tag of the parent element (or EOF).
        /// </remarks>
        /// <param name="serializationContext">Serialization context.</param>
        /// <param name="element">In-memory MultiLineCompartment instance that will get the deserialized data.</param>
        /// <param name="reader">XmlReader to read serialized data from.</param>
        public override void Read(DslModeling::SerializationContext serializationContext, DslModeling::ModelElement element, global::System.Xml.XmlReader reader)
        {
            #region Check Parameters
            global::System.Diagnostics.Debug.Assert(serializationContext != null);
            if (serializationContext == null)
                throw new global::System.ArgumentNullException("serializationContext");
            global::System.Diagnostics.Debug.Assert(element != null);
            if (element == null)
                throw new global::System.ArgumentNullException("element");
            global::System.Diagnostics.Debug.Assert(reader != null);
            if (reader == null)
                throw new global::System.ArgumentNullException("reader");
            #endregion

            // Read properties serialized as XML attributes.
            base.ReadPropertiesFromAttributes(serializationContext, element, reader);

            // Read nested XML elements.
            if (!serializationContext.Result.Failed)
            {
                if (!reader.IsEmptyElement)
                {
                    // Read to the start of the first child element.
                    DslModeling::SerializationUtilities.SkipToFirstChild(reader);

                    // Read nested XML elements, they can be either properties serialized as XML elements, or child 
                    // model elements.
                    while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
                    {
                        base.ReadElements(serializationContext, element, reader);
                        if (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
                        {
                            // Encountered one unknown XML element, skip it and keep reading.
                            ComponentsSerializationBehaviorSerializationMessages.UnexpectedXmlElement(serializationContext, reader);
                            DslModeling::SerializationUtilities.Skip(reader);
                        }
                    }
                }
            }

            // Advance the reader to the next element (open tag of the next sibling, end tag of the parent, or EOF)
            DslModeling::SerializationUtilities.Skip(reader);
        }

        #region TryCreateInstance
        /// <summary>
        /// This method creates a correct instance of MultiLineCompartment based on the tag currently pointed by the reader. If the reader
        /// is positioned at a serialized MultiLineCompartment, a new MultiLineCompartment instance will be created in the given partition, otherwise 
        /// null is returned.
        /// </summary>
        /// <remarks>
        /// The caller will guarantee that the reader is positioned at open XML tag of the next element being read. This method should
        /// not move the reader; the reader should remain at the same position when this method returns.
        /// </remarks>
        /// <param name="serializationContext">Serialization context.</param>
        /// <param name="reader">XmlReader to read serialized data from.</param>
        /// <param name="partition">Partition in which new elements should be created.</param>	
        /// <returns>Created MultiLineCompartment instance, or null if the reader is not pointing to a serialized MultiLineCompartment instance.</returns>
        public override DslModeling::ModelElement TryCreateInstance(DslModeling::SerializationContext serializationContext, global::System.Xml.XmlReader reader, DslModeling::Partition partition)
        {
            #region Check Parameters
            global::System.Diagnostics.Debug.Assert(serializationContext != null);
            if (serializationContext == null)
                throw new global::System.ArgumentNullException("serializationContext");
            global::System.Diagnostics.Debug.Assert(reader != null);
            if (reader == null)
                throw new global::System.ArgumentNullException("reader");
            global::System.Diagnostics.Debug.Assert(partition != null);
            if (partition == null)
                throw new global::System.ArgumentNullException("partition");
            #endregion

            DslModeling::ModelElement result = null;
            if (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
            {
                string localName = reader.LocalName;
                if (string.Compare(localName, this.XmlTagName, global::System.StringComparison.CurrentCulture) == 0)
                {	// New "MultiLineCompartment" instance.
                    result = this.CreateInstance(serializationContext, reader, partition);
                }
                else
                {	// Check for derived classes of "MultiLineCompartment".
                    if (this.derivedClasses == null)
                        this.ConstructDerivedClassesLookupTable(serializationContext, partition.DomainDataDirectory);
                    global::System.Diagnostics.Debug.Assert(this.derivedClasses != null);
                    DslModeling::DomainClassInfo derivedClass = null;
                    if (this.derivedClasses.TryGetValue(localName, out derivedClass) && derivedClass != null)
                    {	// New derived class instance.
                        MultiLineCompartmentSerializer derivedSerializer = serializationContext.Directory.GetSerializer(derivedClass.Id) as MultiLineCompartmentSerializer;
                        global::System.Diagnostics.Debug.Assert(derivedSerializer != null, "Cannot find serializer for " + derivedClass.Name + "!");
                        result = derivedSerializer.CreateInstance(serializationContext, reader, partition);
                    }
                }
            }

            return result;
        }

        /// <summary>
        /// This method creates an instance of MultiLineCompartment based on the tag currently pointed by the reader. The reader is guaranteed (by the caller)
        /// to be pointed at a serialized instance of MultiLineCompartment.
        /// </summary>
        /// <remarks>
        /// The caller will guarantee that the reader is positioned at open XML tag of the ModelRoot instance being read. This method should
        /// not move the reader; the reader should remain at the same position when this method returns.
        /// </remarks>
        /// <param name="serializationContext">Serialization context.</param>
        /// <param name="reader">XmlReader to read serialized data from.</param>
        /// <param name="partition">Partition in which new MultiLineCompartment instance should be created.</param>	
        /// <returns>Created MultiLineCompartment instance.</returns>
        protected override DslModeling::ModelElement CreateInstance(DslModeling::SerializationContext serializationContext, global::System.Xml.XmlReader reader, DslModeling::Partition partition)
        {
            string idStr = reader.GetAttribute("Id");
            try
            {
                global::System.Guid id;
                if (idStr == null)
                {	// Create a default Id.
                    id = global::System.Guid.NewGuid();
                    ComponentsSerializationBehaviorSerializationMessages.MissingId(serializationContext, reader, id);
                }
                else
                {
                    id = new global::System.Guid(idStr);
                }
                return new MultiLineCompartment(partition, new DslModeling::PropertyAssignment(DslModeling::ElementFactory.IdPropertyAssignment, id));
            }
            catch (global::System.ArgumentNullException /* anEx */)
            {
                ComponentsSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "Id", typeof(global::System.Guid), idStr);
            }
            catch (global::System.FormatException /* fEx */)
            {
                ComponentsSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "Id", typeof(global::System.Guid), idStr);
            }
            catch (global::System.OverflowException /* ofEx */)
            {
                ComponentsSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "Id", typeof(global::System.Guid), idStr);
            }
            return null;
        }

        /// <summary>
        /// Stores a mapping from XmlTagName to DomainClassInfo that derives from MultiLineCompartment, created on demand.
        /// </summary>
        private global::System.Collections.Generic.Dictionary<string, DslModeling::DomainClassInfo> derivedClasses;

        /// <summary>
        /// Construct the apping from XmlTagName to DomainClassInfo that derives from MultiLineCompartment.
        /// </summary>
        /// <param name="serializationContext">Serialization context.</param>
        /// <param name="domainDataDirectory">DomainDataDirectory to be used to discover all derived classes.</param>
        private void ConstructDerivedClassesLookupTable(DslModeling::SerializationContext serializationContext, DslModeling::DomainDataDirectory domainDataDirectory)
        {
            global::System.Diagnostics.Debug.Assert(this.derivedClasses == null); // Shouldn't construct the table more than once.
            this.derivedClasses = new global::System.Collections.Generic.Dictionary<string, DslModeling::DomainClassInfo>(global::System.StringComparer.CurrentCulture);

            DslModeling::DomainClassInfo thisClass = domainDataDirectory.GetDomainClass(MultiLineCompartment.DomainClassId);
            global::System.Diagnostics.Debug.Assert(thisClass != null, "Cannot find DomainClassInfo for ModelRoot!");

            global::System.Collections.ObjectModel.ReadOnlyCollection<DslModeling::DomainClassInfo> descendents = thisClass.AllDescendants;
            if (descendents != null)
            {
                foreach (DslModeling::DomainClassInfo descendent in descendents)
                {
                    global::System.Type descendentType = descendent.ImplementationClass;
                    if (!descendentType.IsAbstract)
                    {
                        DslModeling::DomainClassXmlSerializer descendentSerializer = serializationContext.Directory.GetSerializer(descendent.Id);
                        if (descendentSerializer != null)
                        {
                            string descendentXmlTagName = descendentSerializer.XmlTagName;
                            if (!string.IsNullOrEmpty(descendentXmlTagName))
                            {
                                global::System.Diagnostics.Debug.Assert(!this.derivedClasses.ContainsKey(descendentXmlTagName));
                                this.derivedClasses.Add(descendentXmlTagName, descendent);
                            }
                        }
                    }
                    else
                    {   // Ignore abstract derived classes because they cannot be instantiated directly.
                    }
                }
            }
        }
        #endregion

        #region TryCreateMonikerInstance
        /// <summary>
        /// This method creates a Moniker of the correct derived (including MultiLineCompartment itself) instance of MultiLineCompartment based on the tag currently pointed by the reader.
        /// </summary>
        /// <remarks>
        /// The caller will guarantee that the reader is positioned at open XML tag of the next element being read. This method should
        /// not move the reader; the reader should remain at the same position when this method returns.
        /// </remarks>		
        /// <param name="serializationContext">Serialization context.</param>
        /// <param name="reader">XmlReader to read serialized data from.</param>
        /// <param name="sourceRolePlayer">The source role-player instance from which the moniker being created is referenced.</param>
        /// <param name="relDomainClassId">The DomainClass Id of the relationship that connects the sourceRolePlayer to the moniker being created.</param>
        /// <param name="partition">The new Moniker should be created in the Store associated with this partition.</param>			
        /// <returns>Created ModelRoot instance, or null if the reader is not pointing to a correct monikerized instance.</returns>
        public override DslModeling::Moniker TryCreateMonikerInstance(DslModeling::SerializationContext serializationContext, global::System.Xml.XmlReader reader, DslModeling::ModelElement sourceRolePlayer, global::System.Guid relDomainClassId, DslModeling::Partition partition)
        {
            #region Check Parameters
            global::System.Diagnostics.Debug.Assert(serializationContext != null);
            if (serializationContext == null)
                throw new global::System.ArgumentNullException("serializationContext");
            global::System.Diagnostics.Debug.Assert(reader != null);
            if (reader == null)
                throw new global::System.ArgumentNullException("reader");
            global::System.Diagnostics.Debug.Assert(sourceRolePlayer != null);
            if (sourceRolePlayer == null)
                throw new global::System.ArgumentNullException("sourceRolePlayer");
            global::System.Diagnostics.Debug.Assert(partition != null);
            if (partition == null)
                throw new global::System.ArgumentNullException("partition");
            #endregion

            DslModeling::Moniker result = null;
            if (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
            {
                string localName = reader.LocalName;
                if (string.Compare(localName, this.MonikerTagName, global::System.StringComparison.CurrentCulture) == 0)
                {	// New "MultiLineCompartment" moniker instance.
                    result = this.CreateMonikerInstance(serializationContext, reader, sourceRolePlayer, relDomainClassId, partition);
                }
                else
                {	// Check for derived classes of "MultiLineCompartment".
                    if (this.derivedClassMonikers == null)
                        this.ConstructDerivedClassMonikersLookupTable(serializationContext, partition.DomainDataDirectory);
                    global::System.Diagnostics.Debug.Assert(this.derivedClassMonikers != null);
                    DslModeling::DomainClassInfo derivedClass = null;
                    if (this.derivedClassMonikers.TryGetValue(localName, out derivedClass) && derivedClass != null)
                    {	// New derived class moniker instance.
                        MultiLineCompartmentSerializer derivedSerializer = serializationContext.Directory.GetSerializer(derivedClass.Id) as MultiLineCompartmentSerializer;
                        global::System.Diagnostics.Debug.Assert(derivedSerializer != null, "Cannot find serializer for " + derivedClass.Name + "!");
                        result = derivedSerializer.CreateMonikerInstance(serializationContext, reader, sourceRolePlayer, relDomainClassId, partition);
                    }
                }
            }

            return result;
        }

        /// <summary>
        /// This method creates a Moniker of MultiLineCompartment based on the tag currently pointed by the reader.
        /// </summary>
        /// <remarks>
        /// The caller will guarantee that the reader is positioned at open XML tag of the next element being read. This method should
        /// not move the reader; the reader should remain at the same position when this method returns.
        /// </remarks>		
        /// <param name="serializationContext">Serialization context.</param>
        /// <param name="reader">XmlReader to read serialized data from.</param>
        /// <param name="sourceRolePlayer">The source role-player instance from which the moniker being created is referenced.</param>
        /// <param name="relDomainClassId">The DomainClass Id of the relationship that connects the sourceRolePlayer to the moniker being created.</param>
        /// <param name="partition">The new Moniker should be created in the Store associated with this partition.</param>			
        /// <returns>Created ModelRoot instance, or null if the reader is not pointing to a correct monikerized instance.</returns>
        protected override DslModeling::Moniker CreateMonikerInstance(DslModeling::SerializationContext serializationContext, global::System.Xml.XmlReader reader, DslModeling::ModelElement sourceRolePlayer, global::System.Guid relDomainClassId, DslModeling::Partition partition)
        {
            string monikerString = DslModeling::SerializationUtilities.UnescapeXmlString(reader.GetAttribute(this.MonikerAttributeName));
            if (monikerString == null)
            {
                ComponentsSerializationBehaviorSerializationMessages.MissingMoniker(serializationContext, reader, this.MonikerAttributeName);
                return null;
            }
            try
            {	// Normalize the Id.
                global::System.Guid id = new global::System.Guid(monikerString);
                monikerString = id.ToString("D", global::System.Globalization.CultureInfo.CurrentCulture);
                DslModeling::Moniker result = new DslModeling::Moniker(new DslModeling::MonikerKey(monikerString, relDomainClassId, MultiLineCompartment.DomainClassId, partition.Store), partition.Store);
                // Set location info if possible.
                result.Location = serializationContext.Location;
                global::System.Xml.IXmlLineInfo xmlLineInfo = reader as global::System.Xml.IXmlLineInfo;
                if (xmlLineInfo != null)
                {
                    result.Line = xmlLineInfo.LineNumber;
                    result.Column = xmlLineInfo.LinePosition;
                }
                return result;
            }
            catch (global::System.FormatException /* fEx */)
            {
                ComponentsSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, this.MonikerAttributeName, typeof(global::System.Guid), monikerString);
                return null;
            }
            catch (global::System.OverflowException /* oEx */)
            {
                ComponentsSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, this.MonikerAttributeName, typeof(global::System.Guid), monikerString);
                return null;
            }
        }

        /// <summary>
        /// Stores a mapping from Moniker Xml tag name to DomainClassInfo that derives from MultiLineCompartment, created on demand.
        /// </summary>
        private global::System.Collections.Generic.Dictionary<string, DslModeling::DomainClassInfo> derivedClassMonikers;

        /// <summary>
        /// Construct the mapping from Moniker Xml tag name to DomainClassInfo that derives from MultiLineCompartment.
        /// </summary>
        /// <param name="serializationContext">Serialization context.</param>
        /// <param name="domainDataDirectory">DomainDataDirectory to be used to discover all derived classes.</param>
        private void ConstructDerivedClassMonikersLookupTable(DslModeling::SerializationContext serializationContext, DslModeling::DomainDataDirectory domainDataDirectory)
        {
            global::System.Diagnostics.Debug.Assert(this.derivedClassMonikers == null); // Shouldn't construct the table more than once.
            this.derivedClassMonikers = new global::System.Collections.Generic.Dictionary<string, DslModeling::DomainClassInfo>(global::System.StringComparer.CurrentCulture);

            DslModeling::DomainClassInfo thisClass = domainDataDirectory.GetDomainClass(MultiLineCompartment.DomainClassId);
            global::System.Diagnostics.Debug.Assert(thisClass != null, "Cannot find DomainClassInfo for ModelRoot!");

            global::System.Collections.ObjectModel.ReadOnlyCollection<DslModeling::DomainClassInfo> descendents = thisClass.AllDescendants;
            if (descendents != null)
            {
                foreach (DslModeling::DomainClassInfo descendent in descendents)
                {
                    DslModeling::DomainClassXmlSerializer descendentSerializer = serializationContext.Directory.GetSerializer(descendent.Id);
                    if (descendentSerializer != null)
                    {
                        string descendentMonikerTagName = descendentSerializer.MonikerTagName;
                        if (!string.IsNullOrEmpty(descendentMonikerTagName))
                        {
                            global::System.Diagnostics.Debug.Assert(!this.derivedClassMonikers.ContainsKey(descendentMonikerTagName));
                            this.derivedClassMonikers.Add(descendentMonikerTagName, descendent);
                        }
                    }
                }
            }
        }
        #endregion
        #endregion

        #region Write Methods
        /// <summary>
        /// Public WriteMoniker() method that writes a monikerized MultiLineCompartment instance into XML.
        /// </summary>
        /// <param name="serializationContext">Serialization context.</param>
        /// <param name="element">MultiLineCompartment instance to be monikerized.</param>
        /// <param name="writer">XmlWriter to write serialized data to.</param>
        /// <param name="sourceRolePlayer">Source element that references the MultiLineCompartment instance being monikerized.</param>
        /// <param name="relSerializer">Serializer that handles the relationship connecting the source element to the MultiLineCompartment instance being monikerized.</param>
        public override void WriteMoniker(DslModeling::SerializationContext serializationContext, DslModeling::ModelElement element, global::System.Xml.XmlWriter writer, DslModeling::ModelElement sourceRolePlayer, DslModeling::DomainRelationshipXmlSerializer relSerializer)
        {
            #region Check Parameters
            global::System.Diagnostics.Debug.Assert(serializationContext != null);
            if (serializationContext == null)
                throw new global::System.ArgumentNullException("serializationContext");
            global::System.Diagnostics.Debug.Assert(element != null);
            if (element == null)
                throw new global::System.ArgumentNullException("element");
            global::System.Diagnostics.Debug.Assert(writer != null);
            if (writer == null)
                throw new global::System.ArgumentNullException("writer");
            global::System.Diagnostics.Debug.Assert(sourceRolePlayer != null);
            if (sourceRolePlayer == null)
                throw new global::System.ArgumentNullException("sourceRolePlayer");
            global::System.Diagnostics.Debug.Assert(relSerializer != null);
            if (relSerializer == null)
                throw new global::System.ArgumentNullException("relSerializer");
            #endregion

            string monikerString = this.CalculateQualifiedName(serializationContext.Directory, element);
            global::System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(monikerString));
            writer.WriteStartElement(this.MonikerTagName);
            writer.WriteAttributeString(this.MonikerAttributeName, monikerString);
            writer.WriteEndElement();
        }

        /// <summary>
        /// Public Write() method that serializes one MultiLineCompartment instance into XML.
        /// </summary>
        /// <param name="serializationContext">Serialization context.</param>
        /// <param name="element">MultiLineCompartment instance to be serialized.</param>
        /// <param name="writer">XmlWriter to write serialized data to.</param>
        /// <param name="rootElementSettings">
        /// The root element settings if the passed in element is serialized as a root element in the XML. The root element contains additional
        /// information like schema target namespace, version, etc.
        /// This should only be passed for root-level elements. Null should be passed for rest elements (and ideally call the Write() method 
        /// without this parameter).
        /// </param>
        [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", Justification = "Parameter 'rootElementSettings' can be null, so no need to validate.")]
        public override void Write(DslModeling::SerializationContext serializationContext, DslModeling::ModelElement element, global::System.Xml.XmlWriter writer, DslModeling::RootElementSettings rootElementSettings)
        {
            #region Check Parameters
            global::System.Diagnostics.Debug.Assert(serializationContext != null);
            if (serializationContext == null)
                throw new global::System.ArgumentNullException("serializationContext");
            global::System.Diagnostics.Debug.Assert(element != null);
            if (element == null)
                throw new global::System.ArgumentNullException("element");
            global::System.Diagnostics.Debug.Assert(writer != null);
            if (writer == null)
                throw new global::System.ArgumentNullException("writer");
            #endregion

            // Write start of element, including schema target namespace if specified.
            if (rootElementSettings != null && !string.IsNullOrEmpty(rootElementSettings.SchemaTargetNamespace))
                writer.WriteStartElement(this.XmlTagName, rootElementSettings.SchemaTargetNamespace);
            else
                writer.WriteStartElement(this.XmlTagName);

            // Write version info (in the format 1.2.3.4), if necessary
            if (rootElementSettings != null && rootElementSettings.Version != null)
                writer.WriteAttributeString("dslVersion", rootElementSettings.Version.ToString(4));

            // Write out element Id.
            writer.WriteAttributeString("Id", element.Id.ToString("D", global::System.Globalization.CultureInfo.CurrentCulture));

            base.WritePropertiesAsAttributes(serializationContext, element, writer);

            if (!serializationContext.Result.Failed)
            {
                // Write 1) properties serialized as nested XML elements and 2) child model elements into XML.
                base.WriteElements(serializationContext, element, writer);
            }

            writer.WriteEndElement();
        }
        #endregion

        #region Moniker Support
        /// <summary>
        /// This method calculates a moniker to a given MultiLineCompartment instance.
        /// </summary>
        /// <param name="directory">Directory to look up serializer based on model element type.</param>
        /// <param name="element">MultiLineCompartment instance to calculate qualified name for.</param>
        /// <returns>A fully qualified string moniker to the MultiLineCompartment instance.</returns>
        public override string CalculateQualifiedName(DslModeling::DomainXmlSerializerDirectory directory, DslModeling::ModelElement element)
        {
            #region Check Parameters
            global::System.Diagnostics.Debug.Assert(directory != null);
            if (directory == null)
                throw new global::System.ArgumentNullException("directory");
            global::System.Diagnostics.Debug.Assert(element != null);
            if (element == null)
                throw new global::System.ArgumentNullException("element");
            #endregion

            MultiLineCompartment instance = element as MultiLineCompartment;
            global::System.Diagnostics.Debug.Assert(instance != null, "Expecting an instance of MultiLineCompartment!");

            return instance.Id.ToString("D", global::System.Globalization.CultureInfo.CurrentCulture);
        }

        /// <summary>
        /// A domain class can be monikerized in different ways: standard /qualifier/key mechanism, custom moniker, or element ID. If the domain class is serialized
        /// using standard /qualifier/key mechanism, this method returns the qualifier of the moniker; if the domain class uses other ways for monikerization, this method
        /// returns empty string.
        /// </summary>
        /// <param name="directory">Directory to look up serializer based on model element type.</param>
        /// <param name="element">MultiLineCompartment instance to get moniker qualifier from.</param>
        /// <returns>
        /// Value of this element's moniker qualifier property, if it has one, or the value of the container's moniker qualifier property. Or empty string if this
        /// element is not monikerized using standard /qualifier/key mechanism.
        /// </returns>
        public override string GetMonikerQualifier(DslModeling::DomainXmlSerializerDirectory directory, DslModeling::ModelElement element)
        {
            #region Check Parameters
            global::System.Diagnostics.Debug.Assert(directory != null);
            if (directory == null)
                throw new global::System.ArgumentNullException("directory");
            global::System.Diagnostics.Debug.Assert(element != null);
            if (element == null)
                throw new global::System.ArgumentNullException("element");
            #endregion

            return string.Empty;
        }
        #endregion
    }
}